﻿@using Fyp.Models;

@{
    ViewBag.Title = "MeetingList";
}

@{
    Layout = "~/Shared/_layoutPage.cshtml";
    var PageTitle = "Meeting List";
 
    var data = (List< MeetingMinute>)ViewData["data"];

 }
   
@section title
{
    @PageTitle
}
   
<style>
table, td, th
{
border:1px solid green;
padding:2px;
}
th
{
background-color:green;
color:white;
padding:2px;
}
</style>

     <strong>
            <div id="content" style="margin-left: 32px;margin-bottom: -1px;">
                 <h2 style="text-align: center;">Meeting List</h2>
             </div>
    </strong>
     
    @using (Html.BeginForm("SearchMeeting", "MeetingMinute", FormMethod.Post, new { @class = "background" }))
    { 
       <input type ="text" id="search" name="search" placeholder ="Search Meeting Minutes..." style="width: 155px;margin-top: -54px; margin-left: 728px;" />
       <input type="submit"  value="Search"  class ="buttonSave" style="margin-left: 887px;margin-top: -55px;height: 22px; width: 53px;padding: 1px; padding-right: 49px;padding-left: 5px;" />
   
    <table class = "table" style=" margin-left: 51px;">
     <thead>
           <tr>
               <th class="table">Meeting Title</th>
               <th class="table">Meeting Location</th>
               <th class="table">Meeting Date</th>
               <th class="table">Meeting Called By</th>
               <th class="table">Meeting Type</th>
               @if (WebSecurity.IsAuthenticated && Roles.IsUserInRole("Advisor"))
                {
                    <th class="table"></th>
                }
               else
               {
                    <th class="table"></th>
               }
           </tr>
       </thead>
       <tbody> 
       @foreach (var row in data)
       {
           <tr>
                   <td class="table">@row.MMTitle</td>
                   <td class="table">@row.MMLocation</td>
                   <td class="table">@row.MMDate.Value.ToString("dd/MM/yyyy")</td>
                   <td class="table">@row.MCalledBy</td>
                   <td class="table">@row.MMType</td>
                   @if (WebSecurity.IsAuthenticated && Roles.IsUserInRole("Advisor"))
                   {
                      <td><a href='@Url.Action("MeetingMinute", "MeetingMinute", new { Id = @row.MeetingMinuteId})'><img src="~/Images/edit.png" alt="Edit" style="margin-left: 3px;"/></a></td>
                   }
                   else
                   {
                       <td><a href='@Url.Action("MeetingMinute", "MeetingMinute", new { Id = @row.MeetingMinuteId})'><u>View Details</u></a></td>
                   }
            </tr>
       }
        </tbody>
    </table>         
}